
/**
 * base64图片格式转Blob流
 * @param {String} imgSrc 
 * @param {String} name 
 */
export function convertBase64ToBlob(imgSrc){
  var bytes = window.atob(imgSrc); //转换为byte
  //处理异常,将ascii码小于0的转换为大于0
  var ab = new ArrayBuffer(bytes.length);
  var ia = new Int8Array(ab);
  var i;
  for (i = 0; i < bytes.length; i++) {
      ia[i] = bytes.charCodeAt(i);
  }
  //转换成文件，添加文件的type，name，lastModifiedDate属性
  var blob=new Blob([ab], {type:'image/jpeg'});
  blob.lastModifiedDate = new Date();
  blob.name = 'cover.png';
  return blob;
}